<template>
  <div>
    <el-form :model="form" label-width="420px">
      <el-form-item label="text属性的文本输入框限制只能输入数字及小数点后两位">
        <el-input
          v-model="form.money"
          style="width: 200px"
          placeholder="请输入"
          :formatter="
            (value) =>
              `${value}`.replace(/[^\d|\.]/g, '').replace(/(\.\d{2})\d+/g, '$1')
          "
          :parser="
            (value) =>
              `${value}`.replace(/[^\d|\.]/g, '').replace(/(\.\d{2})\d+/g, '$1')
          "
        ></el-input>
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup>
import { reactive } from "vue";

const form = reactive({
  money: "",
});
</script>
